package main

import "fmt"

type MyInterface interface {
	Start()
	Stop()
}

type Computer struct{}

func (c Computer) Start() {
	//TODO implement me
	panic("implement me")
}

func (c Computer) Stop() {
	//TODO implement me
	panic("implement me")
}

type Printer struct {
	Name string
}

func (c Computer) work(myInterface MyInterface) {
	myInterface.Start()
	myInterface.Stop()
}

func (c Printer) Start() {
	fmt.Println(c.Name, "开始工作")
}

func (c Printer) Stop() {
	fmt.Println("停止工作")
}

func (c Printer) work(myInterface MyInterface) {
	fmt.Println("传入sss")
}

func main() {
	printer := Printer{
		Name: "小米打印机",
	}
	var p MyInterface = printer //printer 实现了 Usb 接口
	p.Start()

	com := Computer{}
	com.work(printer)

	var p2 MyInterface = com
	printer.work(p2)
}
